# Maintainer: David Runge <dvzrv@archlinux.org>
# Contributor: Gaetan Bisson <bisson@archlinux.org>
# Contributor: Andrea Scarpino <andrea@archlinux.org>

# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
#  - set b_lto=false in meson arguments

pkgname=libmpdclient
pkgver=2.19
pkgrel=3
pkgdesc="C library to implement a MPD client"
url="https://www.musicpd.org/libs/libmpdclient/"
license=('BSD')
arch=('x86_64')
depends=('glibc')
makedepends=('meson')
provides=('libmpdclient.so')
source=("https://www.musicpd.org/download/${pkgname}/${pkgver%.*}/${pkgname}-${pkgver}.tar.xz"{,.sig})
sha512sums=('5d67b95d4b615bc750641f6d5a0240122e8f59c66108838a96bd4bc5cdda8b15288ad03d0e35d92d6e562e67c600f68aad643ca541092121074952a1bc5b3590'
            'SKIP')
b2sums=('c045c4847d43f166a3e1549654784bd994fa4156e3ecebf7c02a412b34ca150940f3c43cdc385839cd7c281bd4ed4fd1935b757d8505133d146ea955ec2d0832'
        'SKIP')
validpgpkeys=('0392335A78083894A4301C43236E8A58C6DB4512') # Max Kellermann <max@blarg.de>

build() {
  cd "${pkgname}-${pkgver}"
  meson --prefix /usr \
        --libexecdir lib \
        --sbindir bin \
        --buildtype plain \
        --auto-features enabled \
        --wrap-mode nodownload \
        -D b_lto=false \
        -D b_pie=true \
        build
  ninja -C build
}

package() {
  cd "${pkgname}-${pkgver}"
  DESTDIR="${pkgdir}" ninja -C build install
  install -vdm 755 "${pkgdir}/usr/share/licenses/${pkgname}"
  ln -sv "/usr/share/doc/${pkgname}/COPYING" \
    "${pkgdir}/usr/share/licenses/${pkgname}/COPYING"
}
